# -*- coding: utf-8 -*- 
# @Time : 2020/4/25 22:45 
# @Author : ganwei
# @File : 100.py
# @desc : leetcode 100 相同的树
class TreeNode(object):
    def __init__(self, x):
        self.val = x
        self.left = None
        self.right = None

"""
### 递归函数
1. 首先检测本节点值，若均不为None且值相等，说明有可能有子树继续
2. 若p、q均为None说明某分支已经检测完毕此时可返回True
3. 其余情况该函数返回False
"""
def bianliTree(p, q):
    if p != None and q != None and p.val == q.val:
        pass
    elif p == None and q == None:
        return True
    else:
        return False
    return bianliTree(p.left, q.left) and bianliTree(p.right, q.right)


"""
递归方式解题
"""
def solution():
    print("hello")

if __name__ == "__main__":
    print("hello")
    treelist = []
    head = TreeNode(1)
    left = TreeNode(2)
    right = TreeNode(3)
    head.left = None
    head.right = right
    viewTree(head,treelist)
    print(treelist)
